package aufg3;

import java.util.Random;

public class RNG {

	protected long seed;
	private double nextRandomNumber;
	protected Random random;
	protected double minRange;
	protected double maxRange;

	public RNG(long seed) {
		this.seed = seed;
		this.random = new Random(seed);
	}

	public long getSeed() {
		return seed;
	}

	public void setSeed(long seed) {
		this.seed = seed;
		this.random.setSeed(this.seed);
	}

	public double getNextRandomNumber() {
		this.nextRandomNumber = random.nextDouble();
		return this.nextRandomNumber;
	}

	//x=a+(b-a)u
	public double getNextRandomNumberWithRange(double a, double b) {
		this.minRange = a;
		this.maxRange = b;
		this.nextRandomNumber = a + (b - a) * random.nextDouble();
		return this.nextRandomNumber;
	}

	public void setMaxRange(double maxRange) {
		this.maxRange = maxRange;
	}

	public void setMinRange(double minRange) {
		this.minRange = minRange;
	}

	public double getMaxRange() {
		return maxRange;
	}

	public double getMinRange() {
		return minRange;
	}
}
